//C14:14.9:names2.c -- struct as argument and return value.
#include <stdio.h>
#include <string.h>

struct namect
{
	char fname[20];
	char lname[20];
	int letters;
};

struct namect getinfo(void);
struct namect makeinfo(struct namect);
void showinfo(struct namect);

int main(void)
{
	struct namect person;

	person = getinfo();
	person = makeinfo(person);
	showinfo(person);
}

struct namect getinfo(void)
{
	struct namect temp;
	printf("Please enter your first name.\n");
	gets(temp.fname);
	printf("Please enter your last name.\n");
	gets(temp.lname);
	
	return temp;
}

struct namect makeinfo(struct namect info)
{
	info.letters = strlen(info.fname) + strlen(info.lname);
	return info;
}

void showinfo(struct namect info)
{
	printf("%s %s, your name contains %d letters.\n",
			info.fname, info.lname, info.letters);
}

